#ifndef DRAWWIDGET_H
#define DRAWWIDGET_H

#include <QWidget>
#include <QTimer>
#include "hpchart.h"
#include "hardware.h"
class QPoint;
class QPixmap;
class QColor;

class DrawWidget : public QWidget
{
    Q_OBJECT
public:
    DrawWidget();
    ~DrawWidget();
    CHPChart *m_chart;
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void timerEvent(QTimerEvent *);

    void paintEvent(QPaintEvent *);
    void resizeEvent(QResizeEvent *);
    CDevLed *m_led;
    CDevADC *m_adc;
    CDevIR  *m_ir;
    int m_testflg;
public slots:
    void timerEvt();
    void setStyle(int);
    void setWidth(int);
    void setColor(QColor);
    void clear();
    void StartSample();
    void StopSample();
    void Zoom(int,int,int,int);
    void ZoomInHor();
    void ZoomOutHor();
    void ZoomInVer();
    void ZoomOutVer();
    void MoveLeft();
    void MoveRight();
    void MoveUp();
    void MoveDown();
    void Reset();
    void SaveBMP();
    void testNet();
    void SetLed();
    void testMode(bool);
    void GetADInfo(int index,QString &str);
private:
    QPixmap *pix;
    QPixmap *gdipix;
    QPixmap tmppix;
    QPainter *painter;
    QTimer *timer;
    QPoint startPos; 
    QPoint endPos;
    bool isDrawing;
    int style;
    int weight;
    QColor color;
    int timerid;
    bool inResizing;

};

#endif 
